package com.user.profile.service.user;

import com.user.profile.entity.UserEntity;
import com.user.profile.utils.SpringContextUtil;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.CollectionUtils;

/**
 * @Author linlx
 * @Date 2021/9/22 13:56
 * @Description
 **/
public class InsertBuildManage {

  private static final List<InsertBuild> insertBuildList = new ArrayList<>();

  static {
    List<InsertBuild> beanList = SpringContextUtil.getBeans(InsertBuild.class);
    if (!CollectionUtils.isEmpty(beanList)) {
      insertBuildList.addAll(beanList);
    }
  }

  public static List<String> build(List<UserEntity> dataList) {
    List<String> resultList = new ArrayList<>();
    insertBuildList.forEach(bean -> resultList.addAll(bean.build(dataList)));
    return resultList;
  }
}
